<?php  
$pPageIsPublic = false;
include '../_common.php';
	
$_SESSION["m1"]	= "restaurant";
$_SESSION["m2"] = 'restaurant-list';
$objName=null; $objUrl="menuconfig"; $objTitle="Item de Caracter&iacute;stica";

$pTitle  = "Nuevo {$objTitle}";
$pButton = 'Guardar';
$action  = 'add';
$id 	 = intval($_REQUEST['id']);
$pid 	 = intval($_REQUEST['pid']);
$seo	 = NULL;


$objLoad = new MenuConfigDetalle();
$objLoad ->setUid($id);
if ($objLoad ->load()) {
	$pTitle  = "Editar {$objTitle}";
	$pButton = 'Actualizar';
	$action  = 'edit';
	$pid = $objLoad ->menuconfig ->id;
}

if (isset($_POST['submit'])) {
	$objLoad ->setAuto($_POST);
	$objLoad ->menuconfig ->id = $_POST['pid'];
	if ($_POST['action'] == 'edit') {
		$objLoad ->getConnection();
		$objLoad ->setUid($id);
		$objLoad ->update();
		Tzn::redirect("{$objUrl}-add.php?id={$objLoad ->menuconfig ->id}&tab=configdetalle", "{$objTitle} ha sido actualizada.");
	} elseif ($_POST['action'] == 'add') {
		$objLoad ->add();
		Tzn::redirect("{$_SERVER["PHP_SELF"]}?id={$objLoad ->id}", "{$objTitle} ha sido registrado.");
	}
}
?>
<?php include("header.php"); ?>
<script type="text/javascript">
$(document).ready(function(){
	$('#frmMain').validate();	
	$("#price").maskMoney(/*{symbol:'S/. ', symbolStay: false}*/);
});
</script>
<?php include("sidebar.php"); ?>
<ul id="subnav" >
	<li ><a class="back" href="<?= $objUrl ?>-add.php?id=<?= $pid?>&tab=configdetalle" > Atras </a></li>
	<li class="noborder" >
		<a class="add" href="<?= $_SERVER["PHP_SELF"] ?>?pid=<?= $pid?>" > Agregar una <?= $objTitle ?> </a>
	</li>
</ul>
<div id="list">
<h2> <?php echo $pTitle;?> </h2>
	<form action="" method="post" name = "frmMain" id = "frmMain" >
	<fieldset><legend> Informaci&oacute;n General</legend>
		<table cellpadding="0" cellspacing="0" class="table-form"  >
					<tr>
					<th>T&iacute;tulo: </th>
						<td><?php $objLoad ->qText('titulo', '', 'width:580px', 'class="required"');?></td>
					</tr>
					<tr>
						<th>Precio (+): </th>
						<td><?php $objLoad ->qText('precio', '', 'width:86px', 'class="" id="price"');?></td>
					</tr>
					<tr>
						<th>Estado: </th>
						<td><?php $objLoad ->arrayToSelect($objLoad ->_arrStatus, 'estado', $objLoad ->estado, false, 'width:100px', '');?></td>
					</tr>
				</table>
		</fieldset>
	<div style="margin-top:10px">
		<input type="hidden" name="id" value="<?php echo $id; ?>" />
		<input type="hidden" name="pid" value="<?php echo $pid; ?>" />
		<input type="hidden" name="action" value="<?php echo $action; ?>" />
                <input type="submit" name="submit"  value="<?php echo $pButton; ?>" /> &nbsp; <input type="reset" value="Cancelar" onClick="window.location.href='<?= $objUrl ?>-add.php?id=<?= $pid?>&tab=configdetalle'" />
                
            </div>
      </form>

</div>
<?php include("footer.php"); ?>